import request from '@/utils/request'

export function changePwd(data) {
    return request({
        url: '/api/user/change-password',
        method: 'post',
        data
    })
}

export function login(data) {
    return request({
        url: '/api/login',
        method: 'post',
        data
    })
}

export function getInfo(token) {
    return request({
        url: '/api/get-info',
        method: 'get',
        params: {token}
    })
}

export function logout() {
    return request({
        url: '/api/logout',
        method: 'get'
    })
}

export function listUsers(params) {
    return request({
        url: '/api/user/list',
        method: 'get',
        params: params
    })
}

export function pageUsers(params) {
    return request({
        url: '/api/user/page',
        method: 'get',
        params: params
    })
}

export function addUser(data) {
    return request({
        url: '/api/user/add',
        method: 'post',
        data
    })
}

export function updateUser(data) {
    return request({
        url: '/api/user/update',
        method: 'post',
        data
    })
}

export function deleteUser(id) {
    return request({
        url: '/api/user/delete/' + id,
        method: 'delete',
    })
}
